home *** CD-ROM | disk | FTP | other *** search
/ Aminet 32 / Aminet 32 (1999)(Schatztruhe)[!][Aug 1999].iso / Aminet / comm / tcp / AmIRCFetch.lha / Fetch.amirx < prev    next >
Text File  |  1999-05-18  |  6KB  |  163 lines

  1. /* Fetch script for use with AmIRC 2.x
  2.    $VER Fetch.amirx 1.16a (18.05.99)
  3. // Written by Deryk Robosson 11.19.96
  4. //
  5. // 11.24.96 (1.01) - added .readme fetching support
  6. // 16.01.97 (1.02) - added support for result codes
  7. // 04.02.97 (1.03) - added path variable for ftpget and updated
  8. //                   the docs
  9. //                   added support for not obtaining the .readmes
  10. //                   added multi site support - Requested by TheBarron
  11. // 13.02.97 (1.05) - added .readme viewing support - Suggested by Gallant
  12. //                   optimised the source - Suggestions made by Gallant
  13. // 04.03.97 (1.06) - prettied up the display of information
  14. // 18.03.97 (1.07) - cleaned up the code and modified the way
  15. //                   the sitelist is handled. (suggestions and some code by Gallant)
  16. // 25.05.97 (1.071)- added notification to the user of the start of retrieval
  17. // 12.06.97 (1.08) - corrected problem fetching files from root dir of aminet.
  18. //                   (reported by Chris chris@celsworth.demon.co.uk)
  19. // newlook@ameritech.net newlook on #amiga IRC (ANet)
  20. //
  21. // - start WNP work  mail amicon@amicon.net if you have suggestions or problems.
  22. //
  23. // 17.08.97 (1.08a)- added 'missing ftpget' error report.
  24. //                   by John M. Hoyt - amicon@amicon.net
  25. // 04.02.98 (1.09a)- Cleaned up some a couple routines.
  26. // 04.02.98 (1.10a)- Fixed geeked output display reported by Cryto.
  27. // 05.02.98 (1.11a)- Yet another boo-boo fixed that I should have caught before.
  28. // 11.07.98 (1.12a)- Various "stuff" fixed that annoyed me.
  29. // 21.10.98 (1.14a)- Updated Aminet mirror list.
  30. // 18.05.99 (1.15a)- Changed to support Ray Akey's GetClient. (included).
  31. //                   Updated Aminet mirror list.
  32. // 18.05.99 (1.16a)- Revamped method of retrieving .readme for use with GetClient.
  33. //
  34. //  Add this alias to your AmIRC:
  35. //
  36. //  /alias fetch  /rx fetch.amirx %p
  37. //
  38. //  Then use like:   /fetch comm/irc/AmIRCFetch.lha
  39. //  Which would get the original AmIRCFetch from Aminet :)
  40. //
  41. //
  42. //  GetClient is (c) 1999 by Ray Akey and available via irc at:
  43. //  addicted.beyondirc.net    channel #CNetIndependent
  44. //  Ray goes by the nick of HMetal.  And I am there as WarNPeace.
  45. //
  46. */
  47. bold = d2c(2)
  48. underline = '1F'x
  49.  
  50. /* this is the default site list, edit for any changes */
  51.  
  52. site.0 = 6
  53. site.1 = 'us.aminet.net'    /* USA       - Complete mirror (ftp.wustl.edu)*/
  54. site.2 = 'de.aminet.net'    /* Germany   - Complete mirror (ftp.uni-paderborn.de)*/
  55. site.3 = 'uk.aminet.net'    /* UK        - Complete mirror */
  56. site.4 = 'it.aminet.net'    /* Italy     - Complete mirror */
  57. site.5 = 'se.aminet.net'    /* Sweden    - Complete mirror */
  58. site.6 = 'au.aminet.net'    /* Australia - Complete mirror */
  59.  
  60. site_default = 1 /* Change this to your favorite site */
  61.  
  62.  
  63. /* change this to 0 if you don't want readme files, 1 otherwise */
  64. get_readme = 1
  65.  
  66. /* change this to 0 if you don't want the readme files displayed after download , 1 otherwise */
  67. display_readme = 1
  68.  
  69. /* Change this to your default incoming directory */
  70. incoming_dir = 'NEW:'
  71.  
  72. /* Change this to reflect the path of GetClient */
  73. ftpget_path = 'GetClient'
  74.  
  75. /* Change this to your favorite text viewer */
  76. text_viewer = 'multiview'
  77.  
  78. /* Change this to your email address */
  79. pass_word = 'using@fetch.amirx'
  80.  
  81. options results
  82. parse arg file' 'param
  83.  
  84. if file = ''|upper(file) = 'VER' then signal version
  85. if upper(file) = 'HELP' then signal help
  86. if upper(file) = 'SITELIST' then signal listsites
  87.  
  88. if param ~= '' then if datatype(param) = 'NUM' then if param <= site.0 then site_default = param
  89.  
  90. /* prepare for the main file */
  91. remote = '/pub/aminet/'file
  92.  
  93.  
  94.  
  95.  
  96. /* setup the commandline parameters */
  97. getit = ftpget_path' U anonymous P 'pass_word' Q L 'incoming_dir' 'site.site_default||remote
  98. call echo('Now retrieving' site.site_default||remote'.')
  99. ADDRESS COMMAND getit                  /* grab the file */
  100.  
  101. /* inform the user as to the status of the command */
  102. out.0  = 'File retrieval finished (No Errors).'
  103. out.10 = 'Connot locate GetClient exe (Set the path in Fetch.Amirx).'
  104. out.21 = 'Connection refused'
  105. out.22 = 'Unknown error - Contact amicon@amicon.net'
  106. out.23 = 'Unknown error - Contact amicon@amicon.net'
  107. out.24 = 'Unknown error - Contact amicon@amicon.net'
  108. out.25 = 'Xfer failed/file does not exist'
  109. out.26 = 'User not welcome/Service unavailable'
  110. out.27 = 'Bad Username'
  111. out.28 = 'Bad Password'
  112. out.29 = 'No Filename Given'
  113. out.30 = 'No Socket Lib - Try again when you are online!'
  114.  
  115. call echo(out.rc)
  116.  
  117. if rc=0 then do
  118.  if get_readme then do
  119.   if pos('.',file) > 0 then readme_file = left(file,lastpos('.',file))'readme'
  120.   else readme_file = file'.readme'
  121.   remote = '/pub/aminet/'readme_file
  122.  
  123.   /* setup the commandline parameters */
  124.   getit = ftpget_path' U anonymous P 'pass_word' Q L 'incoming_dir' 'site.site_default||remote
  125.   call echo('Now retrieving' site.site_default||remote'.')
  126.   ADDRESS COMMAND getit                  /* grab the file */
  127.   call echo(out.rc)
  128.   if display_readme then address command text_viewer' 'incoming_dir||substr(readme_file,lastpos('/',readme_file)+1,length(readme_file))
  129.   end
  130. end
  131. exit
  132.  
  133. Else exit
  134.  
  135. version:    /* show the user version information */
  136.     call echo(bold'Fetch.AMIRX'bold' Version 'subword(sourceline(2),3,2))
  137.     call echo('Read the top of Fetch.AMIRX script for history.')
  138.     call echo(bold'©1996,1997'bold' Deryk Robosson 'bold'(newlook)'bold' - [newlook@ameritech.net]')
  139.     call echo('mods by 'bold'©1997-99'bold' John M. Hoyt 'bold'(WarNPeace)'bold' - [amicon@amicon.net]')
  140.     call echo(bold'HELP:'bold' /fetch help')
  141. exit
  142.  
  143. help:   /* show the user help examples */
  144.     call echo(bold'Fetch.AMIRX'bold' Help')
  145.     call echo('/<alias> comm/tcp/AmIRCFetch.lha 2 to get file from site #2')
  146.     call echo(bold'SITELIST - 'bold'displays current aminet site list')
  147.     call echo(bold'VER - 'bold'displays script version')
  148.     call echo(bold'HELP - 'bold'displays this')
  149. exit
  150.  
  151. listsites: /* show the user all sites */
  152.     call echo(bold||underline'SiteList')
  153.     do i=1 to site.0
  154.         call echo(i' - 'site.i)
  155.     end
  156. exit
  157.  
  158. echo: procedure
  159.     parse arg a
  160.     'echo P='d2c(27)'b«Fetch» 'a
  161. return 1
  162.  
  163.